package com.ssy.lingxi.marketing.model.constant;

import com.ssy.lingxi.common.language.LanguageHolder;

import java.util.Arrays;

/**
 /**
 * 活动参与类型: 1：商家报名活动；2：平台自建活动；
 * @author ds
 * @date 2021/6/18
 * @version 2.0.0
 */
public enum ActivitySignUpTypeEnum {
    ALL(0,"未知"),
    SUPPLIER(1, "商家报名活动"),
    PLATFORM(2, "平台自建活动"),
    ;

    private final Integer code;
    private final String message;

    ActivitySignUpTypeEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return LanguageHolder.getName(this.getClass(), this.code);
    }

    public static String getMessage(Integer code) {
        return Arrays.stream(ActivitySignUpTypeEnum.values()).filter(e -> e.getCode().equals(code)).findFirst().orElse(ALL).getMessage();
    }
    public static ActivitySignUpTypeEnum find(Integer code) {
        return Arrays.stream(ActivitySignUpTypeEnum.values()).filter(e -> e.getCode().equals(code)).findFirst().orElse(null);
    }


}
